//
//  DummyContent.swift
//  SwiftUILean
//
//  Created by wyknmjj on 2024/5/14.
//

import SwiftUI

struct DummyContent: View {
    var body: some View {
        LazyVStack(spacing: 15){
            DummySection(title: "Social Media")
            DummySection(title: "Sales",isLong:true)
            ImageView("Pic 1")
            DummySection(title: "Busniess",isLong:true)
            DummySection(title: "Promotion",isLong:true)
            ImageView("Pic 2")
            DummySection(title: "YouTube")
            DummySection(title: "Twitter(X)")
            DummySection(title: "Marketing Campaign",isLong:true)
            ImageView("Pic 3")
            DummySection(title: "Conslusion",isLong:true)
        }.padding(15)
    }
    
    @ViewBuilder
    func DummySection(title:String, isLong:Bool = false) -> some View{
        VStack(alignment: .leading, spacing: 8){
            Text(title).font(.title.bold())
            
            Text("DailyCost is a simple and elegant expense tracker that helps you organize your personal finance. With just few taps and swipes, you can easily keep track of your daily expenses and learn how to spend your money smarter.\(isLong ? " Supporting 160+ currencies with automatically updated exchange rates, DailyCost could be your best travel companion to go around the world.":"")").multilineTextAlignment(.leading).kerning(1.2)
        }.frame(maxWidth: .infinity,alignment: .leading)
    }
    
    @ViewBuilder
    func ImageView(_ image:String) -> some View{
        GeometryReader{
            let size = $0.size
            Image(image)
                .resizable()
                .aspectRatio(contentMode: .fill)
                .frame(width: size.width,height:size.height)
                .clipped()
        }.frame(height: 400)
    }
}

#Preview {
    DummyContent()
}
